#ifndef UART_H
#define UART_H
#include <QKeyEvent>
#include <QSerialPort>
#include <QDebug>
#include <QCheckBox>
#include <QImage>
#include <QDir>
#include <QtGlobal>
#define MAX_PreWin 3
#define COM_PORT "ttyS1"
#define currentWaitTimeout  1000
#define SelBox(A)     SelectBox(&box_sel,A);
#define QRC_File "://style.qss"
#ifdef Q_PROCESSOR_X86
#define LOGO_File "./image/MURIDEO-Blue.jpg"
#else
#define LOGO_File "/usr/bin/image/MURIDEO-Blue.jpg"
#endif
//#define QRC_File ".//style.qss"
#define VIDEO_DEV "/dev/video0"
#define DEFAULT_WIDTH   1280
#define DEFAULT_HEIGHT  720
#define COMBINE_PARAM(p1,p2,p3) p1+(p2<<8)+(p3<<16)
void serial_init();
int sendUartCmd(int cmd,int param);
int sendUartCmd_timing(int timing_code);
int sendUartCmd_pattern(int pattern_code);
int sendUart();
int ShowWin(int win_key,bool IsPreWin);
int ShowPreWin();
bool SelectBox(QCheckBox **old_box,QCheckBox *new_box);
void SetPattern(int nPattern);
int GetPattern(void);
QImage *GetLogo();
enum MultiWin_Key
{
    win_AUDIO,
    win_HDR,
    win_VESA,
    win_4K=Qt::Key_4,
    win_PATTERN=Qt::Key_P,
    win_SINKINFO=Qt::Key_S,
    win_8K=Qt::Key_8,
    win_HD=Qt::Key_H,
    win_HDCP=Qt::Key_C,
    win_MUTE=Qt::Key_U,
    win_MAIN=Qt::Key_0,
    win_DSC=Qt::Key_D,
    win_SG=Qt::Key_G,
    win_SA=Qt::Key_A,
    win_EDID=Qt::Key_E,
    win_MONITOR=Qt::Key_M,
    win_Signal_Info=Qt::Key_I,
    win_Error_Rate=Qt::Key_R
};
enum COMMAND_List
{
    timing_sel=0x61,
    pattern_sel,
    colorspace_sel,
    colordepth_sel,
    hdcp_setup,
    hdmi_dvi_sel,
    audio_sampling_rate_sel,
    audio_bit_depth_sel,
    audio_source_sel,
    audio_channel_num_sel,
    audio_speaker_placement,
    audio_volume_setup=0x6d,
    hdr_setup=0x6f,
    sinewave_tone=0x73,
    set_link_training=0xc0
};

enum Signal_Timing_Table
{
    vesa_640x480=0,
    vesa_800x600,
    vesa_1024x768,
    vesa_1280x768,
    vesa_1360x768,
    vesa_1280x960,
    vesa_1280x1024,
    vesa_1400x1050,
    vesa_1600x1200,
    vesa_1920x1200,

    hd_720p_60=0x0c,
    hd_720p_5994,
    hd_1080i_60,
    hd_1080i_5994,
    hd_1080p_30,
    hd_1080p_2997,
    hd_1080p_24,
    hd_1080p_23976,
    hd_1080p_60,
    hd_1080p_5994,

    hd_720p_50=0x18,
    hd_1080i_50,
    hd_1080p_25,
    hd_1080p_50,
    k4_30=0x1c,
    k4_2997,
    k4_25,
    k4_24,
    k4_23,
    k4_60=0x22,
    k4_5994,
    k4_50,
    vesa_1440x900=0x45,
    vesa_1600x900,
    vesa_1152x864_75hz=0x48,
    hd_1080p_120=0x51,
    hd_1080p_119,
    hd_1080p_100=0x66,
    k4_48=0x67,
    k4_47,
    k4_100=0x6b,
    k4_120,
    k4_119,
    k8_30=0x6e,
    k8_29,
    k8_25,
    k8_24,
    k8_23,
    k8_60,
    k8_59,
    k8_50,
    k8_48,
    k8_47
};
enum Pattern_Table
{
    COLORBAR100P=0,
    COLORBAR75P,
    STEPGRAYBAR8,
    STEPGRAYBAR16,
    REDSCREEN,
    GREENSCREEN,
    BLUESCREEN,
    CYANSCREEN,
    MEGNTASCREEN,
    YELLOWSCREEN,
    BLACKSCREEN,
    WHITESCREEN,
    VER_SPLIT,
    HOR_SPLIT,
    VER_MULTIBURST,
    HOR_MULTIBURST,
    QUARTER_BLOCK4X4_BF,
    QUARTER_BLOCK4X4_WF,
    ALTERNATE_PIXEL,
    RGBMYRAMPS,
    BLACKPLUGE,
    WHITEPLUGE,
    STILL_GRAYRAMP_BF,
    STILL_GRAYRAMP_WF,
    SMPTECOLORBAR,
    GEOMETRY,
    WINDOW,
    BOXS_3D,
    VER_WHITESCROLL,
    HOR_WHITESCROLL,
    AV_SYNC_WB,
    MGRAYRAMP,
    MREDRAMP,
    MGREENRAMP,
    MBLUERAMP,
    MOVINGBALL,
};
enum Color_Depth
{
    color_8BIT,
    color_10BIT,
    color_12BIT,
    color_16BIT,
    color_AUTO
};
enum HDCP_Config
{
    HDCP_OFF,
    HDCP_14,
    HDCP_22,
    HDCP_AUTO
};
enum AUDIO_Sampling_Rate
{
    audio_32K,
    audio_44_1K,
    audio_48K,
    audio_88K,
    audio_96K,
    audio_176K,
    audio_192K,
    audio_sr_auto
};
enum AUDIO_Bit
{
    audio_16bit,
    audio_20bit,
    audio_24bit,
    audio_bit_auto
};
enum HDR_List
{
    HDR_OFF,
    HDR_10,
    HLG,
    HDR_CUSTOM1,
    HDR_CUSTOM2,
    HDR_CUSTOM3,
    HDR_CUSTOM4,
    HDR_CUSTOM5,
    HDR_CUSTOM6,
    HDR_CUSTOM7,
    HDR_CUSTOM8
};
enum SINEWAVE_TONE
{
    PCM_SINEWAVE_100,
    PCM_SINEWAVE_200,
    PCM_SINEWAVE_300,
    PCM_SINEWAVE_400,
    PCM_SINEWAVE_500,
    PCM_SINEWAVE_600,
    PCM_SINEWAVE_700,
    PCM_SINEWAVE_800,
    PCM_SINEWAVE_900,
    PCM_SINEWAVE_1K,
    PCM_SINEWAVE_2K,
    PCM_SINEWAVE_3K,
    PCM_SINEWAVE_4K,
    PCM_SINEWAVE_5K,
};
enum SPEAKER_PLACEMENT
{
    FR_FL,
    LFE_FR_FL,
    FC_FR_FL,
    FC_LFE_FR_FL,
    RC_FR_FL,
    RC_LFE_FR_FL,
    RC_FC_FR_FL,
    RC_FC_LFE_FR_FL,
    RR_RL_FR_FL,
    RR_RL_LFE_FR_FL,
    RR_RL_FC_FR_FL,
    RR_RL_FC_LFE_FR_FL,
    RC_RR_RL_FR_FL,
    RC_RR_RL_LFE_FR_FL,
    RC_RR_RL_FC_FR_FL,
    RC_RR_RL_FC_LFE_FR_FL,
    RRC_RLC_RR_RL_FR_FL,
    RRC_RLC_RR_RL_LFE_FR_FL,
    RRC_RLC_RR_RL_FC_FR_FL,
    RRC_RLC_RR_RL_FC_LFE_FR_FL,
    FRC_FLC_FR_FL,
    FRC_FLC_LFE_FR_FL,
    FRC_FLC_FC_FR_FL,
    FRC_FLC_FC_LFE_FR_FL,
    FRC_FLC_RC_FR_FL,
    FRC_FLC_RC_LFE_FR_FL,
    FRC_FLC_RC_FC_FR_FL,
    FRC_FLC_RC_FC_LFE_FR_FL,
    FRC_FLC_RR_RL_FR_FL,
    FRC_FLC_RR_RL_LFE_FR_FL,
    FRC_FLC_RR_RL_FC_FR_FL,
    FRC_FLC_RR_RL_FC_LFE_FR_FL,
};
enum FORCE_LINK_TRAIN
{
    FRL_Disable,
    FRL_Enable
};
enum
{
    DSC_Disable,
    DSC_Enable
};
enum
{
    FRL_OFF,
    Lanes3_3G,
    Lanes3_6G,
    Lanes4_6G,
    Lanes4_8G,
    Lanes4_10G,
    Lanes4_12G,
};
enum
{
    FRL_LT_STOP,
    FRL_LT_PROGRESS,
    FRL_LT_PASS,
    FRL_LT_TMDS
};

#endif // UART_H
